package com.teamclub.erp.sservices

import io.ebean.Ebean
import com.teamclub.domain.system.AppDomainInstance
import com.teamclub.pay.sforms.{PayOrderForm}
import com.teamclub.pay.sservices.XPayService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

@Service
class ErpPayService {
  @Autowired
  var xpay: XPayService = _

  def appPay(form: PayOrderForm) = {
    val instance = Ebean.find(classOf[AppDomainInstance]).where().eq("appDomain", "WINDER-MANAGER").findOne()
    form.setOrganNo(instance.getOrganNo) //设置收款人信息
    xpay.appPay(form)
  }

  def payThirdQuery(form: PayOrderForm) = {
    val instance = Ebean.find(classOf[AppDomainInstance]).where().eq("appDomain", "WINDER-MANAGER").findOne()
    form.setOrganNo(instance.getOrganNo)
    xpay.thirdQueryOrder(form)
  }

  def appNotify = {

  }
}
